<template>
    <div>

        <!-- <nav>
            <router-link to="/goods">套餐页</router-link>
        </nav> -->

        <el-table  height="400" border stripe :cell-style="{ textAlign: 'center',color:'black' }" :header-cell-style="{ 'text-align': 'center',color:'black' }"
            :data="orderList">
            <el-table-column prop="orderId" label="订单号" />
            <el-table-column prop="goodsName" label="套餐名" />
            <el-table-column prop="goodsDescription" label="套餐描述" />
            <el-table-column prop="price" label="订单价格" />
            <el-table-column prop="createTime" label="创建时间" />
            <el-table-column prop="payTime" label="支付时间" />
            <el-table-column prop="status" label="订单状态">
                <template v-slot="scope">
                    <el-button style="background-color: #EFF7EA; color: #84C395;"
                        v-if="scope.row.status == 1">已支付</el-button>
                    <el-button style="background-color: #FCF6EA; color: #DFAF89;"
                        v-if="scope.row.status == 0">待支付</el-button>
                </template>
            </el-table-column>
            <el-table-column label="操作">
                <template v-slot="scope">
                    <el-button v-show="scope.row.status == 0" type="primary" @click="pay(scope.row)">去支付</el-button>
                </template>

            </el-table-column>
        </el-table>

    </div>
</template>

<script>
import { list } from '@/api/order'
export default {
    data() {
        return {
            orderList: []

        }
    },
    mounted() {
        list().then(res => {
            console.log(res);

            this.orderList = res.data
        })
    },
    methods: {
        pay(row) {
            // console.log(row);
            // var url = 'http://7ac071bc.r27.cpolar.top'
            var url = 'http://127.0.0.1:1145'
            window.location.href = url + '/alipay/pay?orderId=' + row.orderId
            // this.$message.success('订单:' + row.orderId +'  支付成功')
            // window.open('http://119.29.202.127:8080/ai/alipay/pay?orderId=' + row.orderId)
            // window.open('http://127.0.0.1:1145/alipay/pay?orderId=' + row.orderId)
        }

    },

}
</script>

<style></style>